package Year22_Month03.day10;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int a = sc.nextInt();
            int count = 0;
            for (int i = 1; i < a; i++) {
                if(perfectNumber(i)){
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    public static boolean perfectNumber(int a){
        int res = 0;
        for (int i = 1; i < a; i++) {
           if(a % i == 0){
               res += i;
           }
        }
        if(res == a){
            return true;
        }else{
            return false;
        }
    }
}
